package chapter06;

import java.util.Scanner;

public class Day1 {
    public static void main(String[] args) {
        System.out.println("1:购物超过50元，加1元换购500毫升可乐；");
        System.out.println("2:购物超过100元，加2元换购1000毫升果汁；");
        System.out.println("3:购物超过100元，加4元换购炫迈口香糖一瓶；");
        System.out.println("4:购物超过200元，加38元换购一瓶进口红酒；");
        System.out.println("5:购物超过200元，加15元换购1袋面粉；");
        System.out.println("0:不换购");

        int addcost = 0;
        int choice = 0;
        Scanner input = new Scanner(System.in);
        System.out.println("请输入购物金额：");
        double age = input.nextDouble();

        System.out.println("请输入你要换购的商品：");
        choice = input.nextInt();

        if (age >= 50) {
            switch (choice) {
                case 0:
                    System.out.println("不换购");
                    break;
                case 1:
                    System.out.println("购物超过50元，加1元换购500毫升可乐");
                    if (age >= 50) {
                        addcost = 1;
                        System.out.println("您本次消费金额：" + age + "元,换购活动是：" + choice + ",换购的商品是：可乐" + "，实际支付金额是：" + (age + addcost) + "元");
                    } else {
                        System.out.println("你未达到规定金额");
                    }
                    break;
                case 2:
                    System.out.println("购物超过100元，加2元换购1000毫升果汁");
                    if (age >= 100) {
                        addcost = 2;
                        System.out.println("您本次消费金额：" + age + "元,换购活动是：" + choice + ",换购的商品是：果汁" + "，实际支付金额是：" + (age + addcost) + "元");
                    } else {
                        System.out.println("你未达到规定金额");
                    }
                    break;
                case 3:
                    System.out.println("购物超过100元，加4元换购炫迈口香糖一瓶");
                    if (age >= 100) {
                        addcost = 4;
                        System.out.println("您本次消费金额：" + age + "元,换购活动是：" + choice + ",换购的商品是：口香糖" + "，实际支付金额是：" + (age + addcost) + "元");
                    } else {
                        System.out.println("你未达到规定金额");
                    }
                    break;
                case 4:
                    System.out.println("购物超过200元，加38元换购一瓶进口红酒");
                    if (age >= 200) {
                        addcost = 38;
                        System.out.println("您本次消费金额：" + age + "元,换购活动是：" + choice + ",换购的商品是：进口红酒" + "，实际支付金额是：" + (age + addcost) + "元");
                    } else {
                        System.out.println("你未达到规定金额");
                    }
                    break;
                case 5:
                    System.out.println("购物超过200元，加15元换购1袋面粉");
                    if (age >= 200) {
                        addcost = 15;
                        System.out.println("您本次消费金额：" + age + "元,换购活动是：" + choice + ",换购的商品是：1袋面粉" + "，实际支付金额是：" + (age + addcost) + "元");
                    } else {
                        System.out.println("你未达到规定金额");
                    }
                    break;
                default:
                    System.out.println("金额不够");
                    System.exit(1);
            }

        }else {
            System.out.println("您消费的金额不够");
        }
        System.out.println("------------------------");
    }
}
